<template>
  <a-config-provider :locale="locale">
    <div id="app">
      <a-spin :spinning="loading" size="large">
        <router-view v-if="isRouterAlive"/>
      </a-spin>
    </div>
  </a-config-provider>
</template>

<script>
  import {mapState} from 'vuex';

  export default {
    name: 'App',
    //提供页面reload方法
    provide() {
      return {
        reload: this.reload
      }
    },
    data() {
      return {
        locale: this.$zhCN,  //设置全局中文化,
        isRouterAlive: true,  //刷新页面用
      }
    },
    computed: {
      ...mapState(['loading'])
    },
    methods: {
      reload() {
        this.isRouterAlive = false
        this.$nextTick(function () {
          this.isRouterAlive = true;
        })
      }
    }
  }
</script>

<style>
  /*a标签*/
  a:hover, a:focus {
    text-decoration: none;
  }

  /*i标签*/
  .anticon {
    vertical-align: 2px;
  }
</style>
